<template>
  <Dialog title="详情" v-model="dialogVisible" width="80%" center>
    <el-card shadow="never">
      <el-descriptions :column="1">
        <el-descriptions-item>
          <template #label>
            <descriptions-item-label label="商家名称" />
          </template>
          {{ data.name }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template #label>
            <descriptions-item-label label="商家类型" />
          </template>
          {{ data.merchantTypeName }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template #label>
            <descriptions-item-label label="商家地址" />
          </template>
          {{ data.address }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template #label>
            <descriptions-item-label label="商家介绍" />
          </template>
          {{ data.merchantIntro }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template #label>
            <descriptions-item-label label="商家封面" />
          </template>
          <img :src="data.merchantCover" class="h150px w150px v-text-top" />
        </el-descriptions-item>
      </el-descriptions>
    </el-card>
  </Dialog>
</template>
<script setup lang="ts">
import * as MerchantListApi from '@/api/blind/merchantList'

const dialogVisible = ref(false) // 弹窗的是否展示
const data = ref<MerchantListApi.MerchantListVO>({} as MerchantListApi.MerchantListVO)

/** 打开弹窗 */
const open = async (id?: number) => {
  dialogVisible.value = true
  // 修改时，设置数据
  if (id) {
    data.value = await MerchantListApi.getMerchantList(id)
  }
}
defineExpose({ open }) // 提供 open 方法，用于打开弹
</script>
<style scoped lang="scss">
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
</style>
